package day0925;

import java.util.TreeSet;

class Dog implements   Comparable<Dog>{//2.
    int age;
    @Override
    public int compareTo(Dog o) {
        return this.age-o.age;
    }
}

public class T1_3 {
    public static void main(String[] args) {
        TreeSet<Dog>  set=new TreeSet();//1.
        Dog  wangC=new Dog();  wangC.age=1;   set.add(wangC);//3.
        Dog  xiaoH=new Dog();  xiaoH.age=0;   set.add(xiaoH);
        for(Dog d:set){
            System.out.println("d.age = " + d.age);
        }
    }
}




//群里